import {createRouter, createWebHistory} from "vue-router";

const Home = () => import('@/views/home/Home')
const Blog = () => import('@/views/blog/Blog')
const BlogArticleDetail = () => import('@/views/blog/childComps/detail/BlogArticleDetail')
const BlogArticles = () => import('@/views/blog/childComps/articles/BlogArticles')
const BlogEditorPage = () => import('@/views/blog/childComps/editor/BlogEditorPage')

const routes = [
  {
    path: '',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home
  },
  {
    path: '/blog',
    component: Blog,
    children: [
      {path: '', redirect: '/blog/articles'},
      {path: 'articles', component: BlogArticles},
      {path: 'article_detail', component: BlogArticleDetail},
      {path: 'article_edit', component: BlogEditorPage},
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

// const originalPush = VueRouter.prototype.push
//
// VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err)}


export default router
